package com.example.demo.service;

import java.util.concurrent.Callable;

public class ExecutorTaskService {
    public Runnable taskRun() {
        return new Runnable() {
            @Override
            public void run() {
                try {
                    Thread.sleep(1200);
                } catch (Exception e) {
                    System.out.println(e.getMessage());
                }
                System.out.println("do task DDD");
            }
        };
    }

    public Callable taskCallA() {
        return new Callable() {
            @Override
            public Boolean call() throws Exception {
                Thread.sleep(100);
                return true;
            }
        };
    }

    public Callable taskCallB() {
        return new Callable() {
            @Override
            public Boolean call() throws Exception {
                Thread.sleep(200);
                return true;
            }
        };
    }

    public Callable taskCallC() {
        return new Callable() {
            @Override
            public Boolean call() throws Exception {
                Thread.sleep(300);
                return true;
            }
        };
    }

    public Boolean taskCallsA() {
        return true;
    }

    public Boolean taskCallsB() {
        return true;
    }

    public Boolean taskCallsC() {
        return false;
    }
}
